package com.guang.springbootsmbj.smbj;

import com.guang.springbootsmbj.pojo.SmbInfo;
import com.hierynomus.smbj.SmbConfig;
import org.springframework.util.Assert;

import java.util.concurrent.TimeUnit;

/**
 * @author liguang
 * @date 2022/8/19 15:58
 */
public class GenericSmbj implements SmbjConfig,SMBJService{

    private SmbInfo smbInfo;

    @Override
    public SmbConfig initSMBJ(SmbInfo smbInfo) {
        Assert.notNull(smbInfo,"配置SMBJ类不能为空");
        SmbConfig smbConfig = SmbConfig.builder().withReadBufferSize(smbInfo.getReadBufferSize())
                .withTimeout(smbInfo.getTimeout(), TimeUnit.SECONDS)
                .withReadTimeout(smbInfo.getReadTimeout(), TimeUnit.SECONDS)
                .withSoTimeout(smbInfo.getSocketTimeout(), TimeUnit.SECONDS)
                .build();
        return smbConfig;
    }

    @Override
    public void exportFiles(SmbInfo smbInfo) {

    }


    @Override
    public String getHostName() {
        return null;
    }

    @Override
    public String getDomainName() {
        return null;
    }

    @Override
    public String getUserName() {
        return null;
    }

    @Override
    public String getPassword() {
        return null;
    }
}
